/*
 * Copyright (c) Jiandong.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

/** Spec for creating a MessageQueueThread. */

  export enum ThreadType {
    MAIN_UI,
    NEW_BACKGROUND,
  }


 export class MessageQueueThreadSpec {

   //  // The Thread constructor interprets zero the same as not specifying a stack size
   public static readonly DEFAULT_STACK_SIZE_BYTES: number = 0;

   private static readonly MAIN_UI_SPEC =
      new MessageQueueThreadSpec(ThreadType.MAIN_UI, "main_ui", null,  MessageQueueThreadSpec.DEFAULT_STACK_SIZE_BYTES);

   private mThreadType: ThreadType;
   private mName: string;
   private mStackSize: number;
   private mPath?: string
   //
   //  private MessageQueueThreadSpec(ThreadType threadType, String name) {
   //    this(threadType, name, DEFAULT_STACK_SIZE_BYTES);
   //  }
   //


   private constructor(threadType: ThreadType, name: string, path?: string, stackSize: number = MessageQueueThreadSpec.DEFAULT_STACK_SIZE_BYTES) {
     this.mThreadType = threadType;
     this.mName = name;
     this.mPath = path;
     this.mStackSize = stackSize;
   }


//  public static newUIBackgroundTreadSpec(name: string, path?: string): MessageQueueThreadSpec {
//    return new MessageQueueThreadSpec(ThreadType.NEW_BACKGROUND, name, path, MessageQueueThreadSpec.DEFAULT_STACK_SIZE_BYTES);
//  }

//  public static newBackgroundThreadSpec(name: string): MessageQueueThreadSpec {
//    return new MessageQueueThreadSpec(ThreadType.NEW_BACKGROUND, name, MessageQueueThreadSpec.DEFAULT_STACK_SIZE_BYTES);
//  }

  public static newBackgroundThreadSpec(name: string, path?: string, stackSize?: number): MessageQueueThreadSpec {
    return new MessageQueueThreadSpec(ThreadType.NEW_BACKGROUND, name, path, stackSize);
  }
//
  public static mainThreadSpec() {
    return MessageQueueThreadSpec.MAIN_UI_SPEC;
  }
//


  public getThreadType() {
    return this.mThreadType;
  }

  public getName() {
    return this.mName;
  }
   public getPath(): string | null {
     return this.mPath
   }

  public getStackSize(): number {
    return this.mStackSize;
  }

}
